package com.cloud.alibaba.controller;

import com.cloud.alibaba.domain.Author;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 刘志强
 * @date 2020/11/17 15:31
 */
@RestController
@Slf4j
public class ProducerController {

    @Autowired
    private Author author;
    @Autowired
    private HttpServletRequest httpServletRequest;

    @GetMapping("/getUserName")
    public String getUserName(String userName) {
        log.info(userName);
        String authorization = httpServletRequest.getHeader("Authorization");
        log.info(authorization);
        return author.toString();
    }
}
